﻿using System.Data.Entity;

namespace DbUtility
{
    public class EF
    {
        public static bool TableExists(DbContext dbc, string table)
        {
            bool answer = false;
            using (dbc)
            {
                answer = dbc.Database.SqlQuery<int?>($@"SELECT 1 FROM sys.tables WHERE T.Name = '{table}'").SingleOrDefaultAsync() != null;
            }
            return answer;
        }
    }
}
